from flask import Blueprint
from flask_restplus import Api

from . import dogs, cats, orgs, users


def init_app(app, prefix='/rest'):

    blueprint = Blueprint('rest', __name__, url_prefix=prefix)
    api = Api(
        blueprint,
        title='用户与组织管理API',
        version='0.1',
        description='''
        用户：
        组织：
        '''
    )

    # api.add_namespace(cats.ns)
    # api.add_namespace(dogs.ns)
    api.add_namespace(users.ns)
    api.add_namespace(orgs.ns)

    app.register_blueprint(blueprint)
